/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package abricots.entity.state;

/**
 *
 * @author charly
 */
public class BasicEntityState implements EntityState {
   protected float posX;
   protected float posY;
   protected float speed;
   protected float angle;
   protected long gameTime;
   protected int entityId;

   public BasicEntityState() {
   }

   public BasicEntityState(float posX, float posY, float speed, float angle, long gameTime, int entityId) {
      this.posX = posX;
      this.posY = posY;
      this.speed = speed;
      this.angle = angle;
      this.gameTime = gameTime;
      this.entityId = entityId;
   }

   @Override
   public int getEntityId() {
      return entityId;
   }

   public void setEntityId(int entityId) {
      this.entityId = entityId;
   }

   @Override
   public long getGameTime() {
      return gameTime;
   }

   public void setGameTime(long gameTime) {
      this.gameTime = gameTime;
   }

   public float getPosX() {
      return posX;
   }

   public void setPosX(float posX) {
      this.posX = posX;
   }

   public float getPosY() {
      return posY;
   }

   public void setPosY(float posY) {
      this.posY = posY;
   }

   public float getAngle() {
      return angle;
   }

   public void setAngle(float angle) {
      this.angle = angle;
   }

   public float getSpeed() {
      return speed;
   }

   public void setSpeed(float speed) {
      this.speed = speed;
   }

   @Override
   public boolean equalsRegardlessOfTime(EntityState other) {
      if (other == null) {
         return false;
      }
      if (getClass() != other.getClass()) {
         return false;
      }
      final BasicEntityState otherStaticState = (BasicEntityState) other;
      if (Float.floatToIntBits(this.posX) != Float.floatToIntBits(otherStaticState.posX)) {
         return false;
      }
      if (Float.floatToIntBits(this.posY) != Float.floatToIntBits(otherStaticState.posY)) {
         return false;
      }
      if (Float.floatToIntBits(this.speed) != Float.floatToIntBits(otherStaticState.speed)) {
         return false;
      }
      if (Float.floatToIntBits(this.angle) != Float.floatToIntBits(otherStaticState.angle)) {
         return false;
      }
      if (this.entityId != otherStaticState.entityId) {
         return false;
      }
      return true;
   }

   @Override
   public EntityState getCopy() {
      return new BasicEntityState(posX, posY, speed, angle, gameTime, entityId);
   }

   @Override
   public String toString() {
      return "BasicState:: gameTime:" + gameTime + " entityId:" + entityId + " posX:" + posX + " posY:" + posY + " speed:" + speed + " angle:" + angle + " ::BasicEntityState";
   }
}
